NumericFunctions.Position expression

Returns the position of a substring within the given character or bit string

Format

ANSI-SQL Format:

POSITION( String1 IN String2 )

ODBC Format:

{{ FN LOCATE ( String1, String2 ) }}

Remarks

Returns the position within String2 of the first ocurrance of String1. The return value is an integer and is defined as follows:

  1. If String1 is of length zero, the return value is one.
  2. If String1 is found within String2, the return value is the character position of the first ocurrance. Character positions are 1-based, so if String1 is found at the start of String2, the return value will be one.
  3. If String1 is not found within String2, the return value is zero.

Both String1 and String2 can be any character or bit string expression.

Example:

POSITION( 'Failed' IN CurrentStateDesc )

POSITION( B'1011' IN B'10010100101101010100010' )

POSITION( X'234' IN X'123456789ABCDEF' )


Disclaimer

Geo SCADA Expert 2022